<style type="text/css">
	
@media only screen and (max-width: 479px) and (min-width: 320px) {
	.s_selected_time {
		width:108px !important;
	}
}
	
</style>
<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['项目管理','设备状态[标记]']" icon="fa fa-smile-o" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>设备状态[标记]</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<sa-company-tree-car companyTreeId="companyTree" wrapId="content" [isShowCarSort]="false" [isShowCarNum]="true" (companySelected)="companySelected($event)"></sa-company-tree-car>
								<!-- <div class="selectDate top_module">
									<span class="top_module_label module_text" style="vertical-align: top;">时间</span>
									<div class="input-daterange input-group s_selected_time_box s_hover_box" style="border-radius: 0 4px 4px 0;">
										<input type="text" [(ngModel)]='table.startTime' class="form-control s_selected_time" id="datetimepicker1"  autocomplete="off" placeholder="选择开始时间"/>
										<span class="s_selected_time_spe">至</span>
										<input type="text" [(ngModel)]='table.endTime' class="form-control s_selected_time" id="datetimepicker2"  autocomplete="off" placeholder="选择结束时间"/>
										<div class="s_del_icon" (click)='del_date_p()'>x</div>
									</div>
								</div> -->
								<div class="top_module top_module_box" style="min-width: auto;">
									<span class="top_module_label module_text">故障类型</span>
									<select name="" class="top_module_select" [(ngModel)]="table.questionType" style="min-width: 110px;" (change)="questionTypeChange()">
										<option value="">全部</option>
										<option value="1">传感器问题</option>
										<option value="2">GPS问题</option>
									</select>
								</div>
								<div class="top_module top_module_box" style="min-width: auto;" *ngIf="table.questionType == 1">
                                    <span class="top_module_label module_text">传感器问题</span>
                                    <select name="" class="top_module_select" [(ngModel)]="table.questionDesc" style="min-width: 110px;">
                                        <option value="">全部</option>
                                        <option value="正负52万">正负52万</option>
                                        <option value="经常52万">经常52万</option>
                                        <option value="偶尔52万">偶尔52万</option>
                                        <option value="乱跳">乱跳</option>
                                    </select>
                                </div>
                                <div class="top_module top_module_box" style="min-width: auto;" *ngIf="table.questionType == 2">
                                    <span class="top_module_label module_text">GPS问题</span>
                                    <select name="" class="top_module_select" [(ngModel)]="table.questionDesc" style="min-width: 110px;">
                                        <option value="">全部</option>
                                        <option value="偶尔丢失">偶尔丢失</option>
                                        <option value="大段丢失">大段丢失</option>
                                        <option value="停车速度平直">停车速度平直</option>
                                        <option value="无GPS">无GPS</option>
                                    </select>
                                </div>
								<div class="selectDate top_module">
									<table-select-date [notInit]='true' (outerTime)="getSelectTableTime($event)"></table-select-date>
								</div>
								<button class="btn btn-primary" (click)="table_search()">查询</button>
								<button type="button" class="btn btn-primary" (click)="export_data()"  style="padding: 4px 12px;">导出</button>
							</div>
							<div class="right top-search">
								<input type="text" [(ngModel)]="table.searchKey" (change)="table_search()" class="search-input" placeholder="车牌号/设备id">
								<span class="top-search-box">
							        <button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
							    </span>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>设备ID</th>
										<th>车牌号码</th>
										<th>公司名称</th>
										<th>传感器问题</th>
										<th>GPS问题</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData" [ngClass]='{selected: row.isChecked }' (dblclick)='checkAbnormal(row)'>
										<td>{{row.deviceId}}</td>
										<td>{{row.carNumber}}</td>
										<td>{{row.parentName}}</td>
										<td>
											<div *ngIf="row.sensorProblemList&& row.sensorProblemList.length > 0">
												<span *ngFor="let item of row.sensorProblemList,let i = index">{{item.sensorProblem}}<span *ngIf="i < row.sensorProblemList.length - 1">,</span></span>
												<button type="button" (click)="tablelook('1',row.sensorProblemList,problemModal)" style="margin-left: 10px;">查看</button>
											</div>
										</td>
										<td>
											<div *ngIf="row.gpsProblemEntity&& row.gpsProblemEntity.gpsProblem">
												<span>{{row.gpsProblemEntity.gpsProblem}}</span>
												<button type="button" (click)="tablelook('2',row.gpsProblemEntity,problemModal)" style="margin-left: 10px;">查看</button>
											</div>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount"
						           [rows]="pageSize"
						           [currentPage]="curPage - 1"
						           (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
			<!-- 传感器详细问题 -->
		<div bsModal #problemModal="bs-modal" id="problemModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
			<div class="modal-dialog modal-lg" style="width: 800px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" (click)="cancelProblemModal(problemModal)"
							aria-label="Close"><span aria-hidden="true">&times;</span></button>
						<h4 class="modal-title">{{problemName}}详细问题</h4>
					</div>
					<div class="modal-body" style="padding: 15px 15px 30px 15px">
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>问题描述</th>
										<th>开始时间</th>
										<th>结束时间</th>
										<th>操作人</th>
										<th>操作时间</th>
									</tr>
								</thead>
								<tbody>

									<tr *ngFor="let row of ProblemModalTableData" >
										<td>
											<span *ngIf="problemName == '传感器'">
												{{row.sensorProblem}}
											</span>
											<span *ngIf="problemName == 'GPS'">
												{{row.gpsProblem}}
											</span>
										</td>
										<td>{{row.startTime}}</td>
										<td>{{row.endTime}}</td>
										<td>{{row.operator}}</td>
										<td>{{row.operatingTime}}</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- 传感器详细问题 end-->
	</sa-widgets-grid>
	<!--折线图-->
		<div  style="background: white;border-radius: 5px;margin-top: 5px;position: relative;padding-bottom: 10px;" [hidden]='!isChartView'>
			<button (click)="closeChart()" class="div_closeBtn"> × </button>
			<div class="widget-body no-padding" style="margin: 0;">
				<div class="top_module" style="display: block;margin: 10px 0 0 10px;padding-top: 10px;">
					<span class="module_text" style="background: none;font-size: 16px;" >异常数据折线图</span>&nbsp;&nbsp;&nbsp;&nbsp;
					<span>车牌号码:[{{abnormalCarNamber}}]&nbsp;&nbsp;公司名称:[{{abnormalompanyName}}]</span>
				</div>
				<div class="top_module abnormalDevice">
					<div *ngFor="let item of abnormalDeviceList" class="abnormalDeviceList" [ngClass]="{isActive:item.isActive == true}" (click)="DeviceListClick(item)">
						<span class="module_text deviceProblem">{{item.problem}}</span>
					</div>
				</div>
				<div class="page-header clearfix s_table_opreation" style="border: 1px solid #ccc;margin: 0 10px;">
					<div style="display: block;margin-left: 20px;position: relative;z-index: 1000;">
						<div>
							<div class="selectDate top_module">
								<table-select-date [specifyId]="specifyId" [notInit]='true' [specifyTime]='specifyTime' (outerTime)="getSelectChartTime($event)" ></table-select-date>
							</div>
							<button type="button" class="btn btn-primary" (click)="drawAbnormalChart()">查看</button>
						</div>
					</div>
					<!-- <div class="left page-header-btn" style="padding: 5px;width: 100%;"></div> -->
					<sa-chart-bmap [height]='485' [offDatas]='true' [inputParams]='selectedRow' [isBaiduMap]='true' (outerSend)="runParent($event)" (outerIsMap)='showMapView($event)' 
						[isAuditData]='false'	[isShowModify]='false'></sa-chart-bmap>
					<div [hidden]='!isMapView'>
						<sa-bmap-chart [trackParams]='drawTrackArr' [isShowBmap]='isMapView' deviceId="deviceId"></sa-bmap-chart>
					</div>
				</div>
			</div>
			
			
		</div>
		<!--折线图end-->
</div>
<style>
	.abnormalDevice{
		padding: 10px 0 0 30px;
		position: relative;
    	height: 46px;
	}
	.abnormalDeviceList{
		display: inline-block;
		border-left: 1px solid #ddd;
		border-top: 1px solid #ddd;
		padding: 8px 10px;
		cursor: pointer;
		position: relative;
    	z-index: 20;
	}
	.abnormalDeviceList:first-child{
		border-top-left-radius: 5px;
	}
	.abnormalDeviceList:last-child{
		border-top-right-radius: 5px;
		border-right: 1px solid #ddd;
	}
	.top_module .deviceProblem{
		background:none;
		font-weight: normal;
	}
	.top_module .isActive{
		color: rgba(26, 109, 221, 1);
		border-bottom: 2px solid #fff;
	}
</style>